<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page language="java" import="com.server.web.JsVersionUtil"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
	<meta charset="UTF-8">
	<title>北京市人民政府外事办公室领事保护教育服务平台</title>
	<!-- 新 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="<c:url value='/share/bootstrap.css'></c:url>">
	<link rel="stylesheet" href="<c:url value='/share/AllStyle.css'></c:url>">
	<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
	<script src="<c:url value='/js/jquery.min.js'></c:url>"></script>
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="<c:url value='/js/bootstrap.min.js'></c:url>"></script>
	<script src="<c:url value='/js/all.js'></c:url>"></script>
	<script src="<c:url value='/js/serverCommonJs.js'></c:url>"></script>
	<script src="<c:url value='/js/rqfCommon/rqfCommon.js'></c:url>"></script>
	<style>
		a:hover{
			text-decoration: none;
		}
		.home_content{
			padding: 0;
		}
		.xiaoxi_title{
			position: relative;
    		overflow: hidden;
			font-size: 14px;
			color: rgb(139, 139, 139);
			background: #e3e8ea;
			text-align: center;
		}
		.xiaoxi_title>ul,.xiaoxi_title>ul>li{
			float: left;
		}
		.xiaoxi_title>ul>li{
			padding: 10px 0;
			width: 135px;
			margin: 0 auto;
			margin-right: 10px;
			background: #eeeeee;
			color:#b6b6b6;
		}
		.xiaoxi_title>ul>li:hover,.xiaoxi_title>div{
			cursor: pointer;
		}
		.xiaoxi_title_LiStyle{
			background: #fff !important;
			color:#2b5eae !important;
		}
		.xiaoxi_title>div{
			float: right;
			width: 135px;
			padding: 10px 0;
			margin: 0 auto;
		}
		.xiaoxi_content>ul{
			padding: 20px 50px;
		}
		.xiaoxi_content>ul>li{
			position: relative;
    		overflow: hidden;
			border-bottom: 1px solid #d5d5d5;
		}
		
		.xiaoxi_content>ul>li:last-child{
			border-bottom: 0;
		}
		.xiaoxi_content>ul>li>a{
			display: block;
			color: #7c7c7d;
		}
		.xiaoxi_content>ul>li>a>div:nth-child(1){
			width: 10px;
			height: 10px;
			border-radius: 50%;
			background: #eb3f3f;
		}
		.xiaoxi_content>ul>li>a>div:nth-child(2){
			margin-left: 10px;
		}
		.xiaoxi_content>ul>li>a>div{
			line-height: 10px;
			float: left;
		}
		.news-list-item-wrap {
		    position: relative;
		    overflow: hidden;
		}
		.news-type.news-app11 {
		    background-position: -109px -12px;
		}
		.news-type {
		    width: 34px;
		    height: 34px;
		    cursor: pointer;
		    margin-left: 20px;
		    margin-top: 2px;
		    display: inline-block;
		    vertical-align: middle;
		    text-decoration: none;
		}
		a:visited, a:link {
		    text-decoration: none;
		}
		.news-list-item-content {
		    height: 25px;
		    line-height: 25px;
		    font-size: 16px;
		    display: inline-block;
		    margin: 20px 0;
		    vertical-align: middle;
		    color: #666;
		}
		.cut-string {
		    overflow: hidden;
		    width: 750px;
		    text-overflow: ellipsis;
		    white-space: nowrap;
		}
		.news-list-item-right {
		    display: inline-block;
		    float: right;
		    line-height: 64px;
		    height: 64px;
		}
		.news-list-item-time {
		    /*color: #959595;*/
		    color: #666;
		}
		.news-list-item-right-op {
			margin-top: -5px;
		    display: inline-block;
		    vertical-align: middle;
		    margin-left: 25px;
		    margin-right: 20px;
		    width: 40px;
		}
		.news-list-item-right-btn {
		    display: none;
		    cursor: pointer;
		    float: left;
		    background: url("<c:url value='/share/images/news_all.png'></c:url>") no-repeat;
		    width: 20px;
		    height: 20px;
		    filter: alpha(opacity=70);
		    -moz-opacity: .7;
		    -khtml-opacity: .7;
		    opacity: .7;
		}
		.news-list-item-right-del {
		    background-position: -258px -90px;
		}
		.news-list-item:hover {
		    background-color: #f5f5f5;
		}
		.news-app11_state{
			background: #979797 !important;
		}
		.news-app11_color_change>a{
			color: rgb(181, 182, 182);
		}
		.Interface_center>div.xiaoxi_content:nth-child(2){
			display: block;
		}
		.Interface_center>div.xiaoxi_content:nth-child(3){
			display: none;
		}
		.pagination_1 {
		    display: inline-block;
		    padding-left: 0;
		    margin: 20px 0;
		    border-radius: 4px;
		}
		.pagination_1>div {
		    cursor: pointer;
		    position: relative;
		    float: left;
		    padding: 6px 12px;
		    margin-left: -1px;
		    line-height: 1.42857143;
		    color: #337ab7;
		    text-decoration: none;
		    background-color: #fff;
		    border: 1px solid #ddd;
		}
		.pagination_1 > li {
		    display: inline;
		}
		.pagination_1 > li > a, .pagination_1 > li > span {
		    position: relative;
		    float: left;
		    padding: 6px 12px;
		    margin-left: -1px;
		    line-height: 1.42857143;
		    color: #337ab7;
		    text-decoration: none;
		    background-color: #fff;
		    border: 1px solid #ddd;
		}
		.modal-title{
			color:#275bac;
		}
		.btn-primary{
			background-color:#275bac;
			border:0px;
		}
	</style>
</head>
<body>
	<div class="home_content Interface_center">
		<div class="xiaoxi_title">
			<ul>
				<li  >全部消息</li>
				<li class="xiaoxi_title_LiStyle">未读消息</li>
			</ul>
			<div style="float: right;" data-id="-1" data-toggle="modal" data-target="#exampleModalAll" data-whatever="@mdo" ><img src="<c:url value='/share/images/delete_jake.png'></c:url>" alt="" style="width: auto;height: auto;margin-right: 8px;">清空所有消息</div>
		</div>
		<div class="modal fade exampleModalAll" id="exampleModalAll" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
		  <div class="modal-dialog" role="document">
		    <div class="modal-content">
		      <div class="modal-header">
		        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
		        <h4 class="modal-title" id="exampleModalLabel">是否清空所有信息</h4>
		      </div>
		      <div class="modal-footer" style="width: 222px;margin: 0 auto;border-top:0;">
		        <button type="button" class="btn btn-default" data-dismiss="modal" style="padding: 6px 25px;">取消</button>
		        <button type="button" class="btn btn-primary" style="float: left;padding: 6px 25px;" id="Msg_clear">确定</button>
		      </div>
		    </div>
		  </div>
		</div>
		<div class="xiaoxi_content">
			<ul id="news-list_msg" >
			</ul>
			<br>
			<br>
			<div id="WH-pagebar" class="WH-pagebar"></div>
			<br>
			<br>
		</div>
		<div class="xiaoxi_content">
			<ul id="news-list_msg_false">
			</ul>
			<br>
			<br>
			<div id="WH-pagebar_1" class="WH-pagebar"></div>
			<br>
			<br>
		</div>
	</div>
	
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	  <div class="modal-dialog">
	    <div class="modal-content" style="padding: 0 25px;">
	      <div class="modal-header" style="padding: 15px 0;border-bottom: 1px solid #1e519f;">
	        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
	        <h4 class="modal-title" id="myModalLabel" style="font-size: 16px;"></h4>
	      </div>
	      <div class="modal-body" style="color: #000;">
	      </div>
	      <div class="modal-body-details" style="position: relative;padding: 15px;border: 1px solid #e3e3e3;color: #000;">
	      </div>
	      <div class="modal-footer" style="border-top: 0;text-align: center;">
	        <button type="button" class="btn btn-primary" data-dismiss="modal" style="padding: 9px 35px;">确定</button>
	      </div>
	    </div>
	  </div>
	</div>
	
	<div class="modal fade" id="myModal_1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	  <div class="modal-dialog">
	    <div class="modal-content" style="padding: 0 25px;">
	      <div class="modal-header" style="padding: 15px 0;border-bottom: 1px solid #1e519f;">
	        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
	        <h4 class="modal-title" id="myModalLabel_1" style="font-size: 16px;"></h4>
	      </div>
	      <div class="modal-body_1" style="color: #000;">
	      </div>
	      <div class="modal-body-details_1" style="position: relative;padding: 15px;border: 1px solid #e3e3e3;color: #000;">
	      </div>
	      <div class="modal-footer" style="border-top: 0;text-align: center;">
	        <button type="button" class="btn btn-primary" data-dismiss="modal" style="padding: 9px 35px;">确定</button>
	      </div>
	    </div>
	  </div>
	</div>

	<script type="text/javascript">
		//获取消息推送信息
		var uuid = '${uuid}';
		var wh_count;//总页数
		var home_index;//当前分页码
		$(function(){
			$(".xiaoxi_title ul li").click(function(){
				$(".xiaoxi_title ul li").removeClass("xiaoxi_title_LiStyle");
				$(this).addClass("xiaoxi_title_LiStyle");
			});
			$(".xiaoxi_title>ul>li").click(function(){
				var index = $(this).index();
				$(".Interface_center>div.xiaoxi_content").hide();
				$(".Interface_center>div.xiaoxi_content:eq("+ index +")").show();
				init_msg(0);
				Unread_msg(0);
				empty();
			});
			init_msg(0);
			Unread_msg(0);
		});
		//全部消息
		var isFirst = true;
		function init_msg(home_index){
			var url = "<c:url value='/msg/list'></c:url>";
			var PageSize = 20;
			$.ajax({
				url: url,
				type: 'POST',
				dataType: 'html',
				data:{
					uuid: uuid,
					"pageIndex" : home_index,//当前分页码
					"pageSize" : PageSize,
				},
				success:function(data){
					var obj = gridDataFormat(data);
					var s_num = obj.count / PageSize;
					wh_count = obj.count;
					var html = "";
					var AlertHtml = "";
					var ContentHtml = "";
					var MsgTitle = "";
					var MsgDetailsHtml = "";
					console.log(obj);
					//全部消息
					for(var i in obj.data){
						ContentHtml = obj.data[i].msgCon == null?"无":obj.data[i].msgCon;
						MsgTitle = obj.data[i].msgName == null?"无":obj.data[i].msgName;
						pushTime = obj.data[i].pushTime == null?"无":obj.data[i].pushTime;
						creater = obj.data[i].creater == null?"无":obj.data[i].creater;
						createTime = obj.data[i].createTime == null?"无":obj.data[i].createTime;
						createTime = createTime.substring(0,10) +"&nbsp;"+ createTime.substring(11,16);
						pushReason = obj.data[i].pushReason == null?"无":obj.data[i].pushReason;
					    MsgDetailsHtml = '<div style="width: 195px; float: left;color:#8c8c8c;">'+
						       			 	'接收人：'+ MsgTitle +''+
							      		 '</div>'+
							      		 '<div style="color:#8c8c8c;">'+
							      		 	 '推送时间：'+ pushTime +''+
							      		 '</div>'+
							      		 '<div style="width: 195px; float: left;color:#8c8c8c;">'+
							      			 '编制人：'+ creater +''+
							      		 '</div>'+
							      		 '<div style="color:#8c8c8c;">'+
							      			 '编制时间：'+ createTime +''+
							      		 '</div>'+
							      		 '<div style="color:#8c8c8c;">'+
							      			 '推送原因： '+ pushReason +''+
							      		 '</div>';
						AlertHtml = obj.data[i].type == "自定义"?'data-toggle="modal" data-target="#myModal" href="javascript:;"':'target="_blank" href="<c:url value="/surveyAnalyze/answerMv/'+ obj.data[i].relatedId +'"></c:url>" onclick="javascript:window.parent.location.reload()"';
						var isRead = obj.data[i].isRead == false?'<div class="news-type news-app11" style="width: 8px;height: 8px;border-radius: 50%;background: #eb3f3f;"></div>'	+'<a '+ AlertHtml +' target="_blank" class="news-list-item-content cut-string" data-id="-1" title="【'+ obj.data[i].type +'】—'+ obj.data[i].msgName +'">【'+ obj.data[i].type +'】—'+ obj.data[i].msgName +'  >></a>'+
								  '<div class="news-list-item-right">'+
								    '<span class="news-list-item-time">2016-08-23&nbsp;&nbsp;10:28</span>':'<div class="news-type news-app11_state" style="width: 8px;height: 8px;border-radius: 50%;background: #eb3f3f;"></div>'	+'<a style="color:#b4b4b4;"'+ AlertHtml +' target="_blank" class="news-list-item-content cut-string" data-id="-1" title="【'+ obj.data[i].type +'】—'+ obj.data[i].msgName +'">【'+ obj.data[i].type +'】—'+ obj.data[i].msgName +'  >></a>'+
									  '<div class="news-list-item-right" >'+
									    '<span class="news-list-item-time" style="color:#b4b4b4;">2016-08-23&nbsp;&nbsp;12:28</span>';
						html += '<li class="news-list-item clearfix">'+
									'<div class="news-list-item-wrap" onclick="state_change('+ obj.data[i].id +')">'+ isRead +
									    '<div class="news-list-item-right-op">'+
									      '<span class="news-list-item-right-del news-list-item-right-btn news-del-btn" data-id="-1" data-toggle="modal" data-target="#exampleModal_'+ obj.data[i].id +'" data-whatever="@mdo"></span>'+
									    '</div>'+
									  '</div>'+
									'</div>'+
									'<div class="modal fade exampleModal_'+ obj.data[i].id +'" id="exampleModal_'+ obj.data[i].id +'" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">'+
									  '<div class="modal-dialog" role="document">'+
									    '<div class="modal-content">'+
									      '<div class="modal-header">'+
									        '<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+
									        '<h4 class="modal-title" id="exampleModalLabel">是否删除</h4>'+
									      '</div>'+
									      '<div class="modal-footer" style="width: 222px;margin: 0 auto;border-top:0;">'+
									        '<button type="button" class="btn btn-default" data-dismiss="modal" style="padding: 6px 25px;">取消</button>'+
									        '<button type="button" class="btn btn-primary" data-id="'+ obj.data[i].id +'" style="float: left;padding: 6px 25px;">确定</button>'+
									      '</div>'+
									    '</div>'+
									  '</div>'+
									'</div>'+
								'</li>';
					}
					$("#news-list_msg").html(html);
					$(".modal-body").html(MsgDetailsHtml);
					$(".modal-body-details").html(ContentHtml);
					$("#myModalLabel").html(MsgTitle);
					$("#news-list_msg li").hover(function(){
						$(this).children().children("div.news-list-item-right").children("div.news-list-item-right-op").children().show();
					},function(){
						$("#news-list_msg li").children().children("div.news-list-item-right").children("div.news-list-item-right-op").children().hide();
					});
					if(obj.count == 0){
						li = "";
						$(".pagination").html(li);
						$("#news-list_msg").html("目前没有消息");
						$("#news-list_msg").css("text-align","center");
						$("#news-list_msg").css("margin-top","50px");
					}
				},
				complete : function(XMLHttpRequest, textStatus) {
					if(isFirst){
						creatPageBar(wh_count,PageSize);
			            isFirst = false;
			        }
				},
				error:function(){
					//console.log();
				}
			});
		}
		
		function creatPageBar(count,PageSize){
			var WHPageBar = document.getElementById('WH-pagebar');
			var CurrentPage = 1;//起始页
			var SingleCount = Math.ceil(count/PageSize);//翻页显示个数
			var PageCount = Math.ceil(count/PageSize);//总页数
			WHPageBar.innerHTML="";
			WH_Pagebar({
				id:'WH-pagebar', //容器ID : 必选参数
				CurrentPage:CurrentPage,   //当前页 ： 可选参数，默认值为1
				SingleCount:SingleCount,   //显示数目： 可选参数，只能为奇数，默认值为7，
				PageCount:PageCount,   //必选参数
				callback : function(pagenow,pagecount){		
					//'当前页:' + pagenow +',总共页:'+pagecount;
					$("#home_Page_video_audio_text").html("");
					init_msg(pagenow - 1);
				}
			})
		}
		
		//改变状态
		function state_change(id){
			var url = "<c:url value='/msg/read'></c:url>";
			$.ajax({
				url: url,
				type: 'POST',
				dataType: 'html',
				data:{
					"ids":id
				},
				success:function(data){
					if(data < 1){
						alert("阅读失败");
						location.reload();
					}
				},
				error:function(){
					//console.log();
				}
			});
		}
		
		init_count();
		//获取未读数
		function init_count(){
			var url = "<c:url value='/msg/count'></c:url>";
			$.ajax({
				url: url,
				type: 'POST',
				dataType: 'JSON',
				data:{
					"uuid": uuid,
					"notRead": true
				},
				success:function(data){
					if(data < 1){
						data = "";
					}else if(data > 9){
						data = "...";
					}
					$("#remindId").html(data);
				},
				error:function(){
					//console.log();
				}
			});
		}
		
		//删除delete
		$("#news-list_msg").on('click',"li .modal .modal-dialog .modal-content .modal-footer .btn-primary",function(){
			var deleteID = $(this).data('id');
			btn_delete(deleteID);
		});
		
		function btn_delete(id){
			var url = "<c:url value='/msg/delete'></c:url>";
			var PageSize = 20;
			$.ajax({
				url: url,
				type: 'POST',
				dataType: 'html',
				data:{
					"ids": id
				},
				success:function(data){
					if(data < 1){
						alert("删除失败,请重新操作!");
					}else{
						location.reload();
					}
				},
				error:function(){
					//console.log();
				}
			});
		}
		
		//未读消息
		var wh_count_1;
		var isFirst_1 = true;
		function Unread_msg(home_index){
			var url = "<c:url value='/msg/list'></c:url>";
			var PageSize = 20;
			$.ajax({
				url: url,
				type: 'POST',
				dataType: 'html',
				data:{
					uuid: uuid,
					"pageIndex" : home_index,//当前分页码
					"pageSize" : PageSize,
					"notRead": true
				},
				success:function(data){
					var obj = gridDataFormat(data);
					var s_num = obj.count / PageSize;
					var html1 = "";
					wh_count_1 = obj.count;
					var AlertHtml = "";
					var ContentHtml = "";
					var MsgTitle = "";
					var MsgDetailsHtml = "";
					//未读消息
					for(var i in obj.data){
						ContentHtml = obj.data[i].msgCon == null?"无":obj.data[i].msgCon;
						MsgTitle = obj.data[i].msgName == null?"无":obj.data[i].msgName;
						pushTime = obj.data[i].pushTime == null?"无":obj.data[i].pushTime;
						creater = obj.data[i].creater == null?"无":obj.data[i].creater;
						createTime = obj.data[i].createTime == null?"无":obj.data[i].createTime;
						createTime = createTime.substring(0,10) +"&nbsp;"+ createTime.substring(11,16);
						pushReason = obj.data[i].pushReason == null?"无":obj.data[i].pushReason;
					    MsgDetailsHtml = '<div style="width: 195px; float: left;color:#8c8c8c;">'+
						       			 	'接收人：'+ MsgTitle +''+
							      		 '</div>'+
							      		 '<div style="color:#8c8c8c;">'+
							      		 	 '推送时间：'+ pushTime +''+
							      		 '</div>'+
							      		 '<div style="width: 195px; float: left;color:#8c8c8c;">'+
							      			 '编制人：'+ creater +''+
							      		 '</div>'+
							      		 '<div style="color:#8c8c8c;">'+
							      			 '编制时间：'+ createTime +''+
							      		 '</div>'+
							      		 '<div style="color:#8c8c8c;">'+
							      			 '推送原因： '+ pushReason +''+
							      		 '</div>';
						var isRead = obj.data[i].isRead == false?'<div class="news-type news-app11" style="width: 8px;height: 8px;border-radius: 50%;background: #eb3f3f;"></div>':'<div class="news-type news-app11_state" style="width: 8px;height: 8px;border-radius: 50%;background: #eb3f3f;"></div>';
						AlertHtml = obj.data[i].type == "自定义"?'data-toggle="modal" data-target="#myModal" href="javascript:;"':'target="_blank" href="<c:url value="/surveyAnalyze/answerMv/'+ obj.data[i].relatedId +'"></c:url>" onclick="javascript:window.parent.location.reload()"';
						html1 += '<li class="news-list-item clearfix">'+
									'<div class="news-list-item-wrap" onclick="state_change('+ obj.data[i].id +')">'+ isRead +'<a '+ AlertHtml +' target="_blank" class="news-list-item-content cut-string" data-id="-1" title="【'+ obj.data[i].type +'】—'+ obj.data[i].msgName +'">【'+ obj.data[i].type +'】—'+ obj.data[i].msgName +'  >></a>'+
									  '<div class="news-list-item-right">'+
									    '<span class="news-list-item-time">2016-08-23&nbsp;&nbsp;10:28</span>'+
									    '<div class="news-list-item-right-op">'+
									      '<span class="news-list-item-right-del news-list-item-right-btn news-del-btn" data-id="-1" data-toggle="modal" data-target="#exampleModal1_'+ obj.data[i].id +'" data-whatever="@mdo"></span>'+
									    '</div>'+
									  '</div>'+
									'</div>'+
									'<div class="modal fade exampleModal_'+ obj.data[i].id +'" id="exampleModal1_'+ obj.data[i].id +'" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">'+
									  '<div class="modal-dialog" role="document">'+
									    '<div class="modal-content">'+
									      '<div class="modal-header">'+
									        '<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>'+
									        '<h4 class="modal-title" id="exampleModalLabel">是否删除</h4>'+
									      '</div>'+
									      '<div class="modal-footer" style="width: 222px;margin: 0 auto;border-top:0;">'+
									        '<button type="button" class="btn btn-default" data-dismiss="modal" style="padding: 6px 25px;">取消</button>'+
									        '<button type="button" class="btn btn-primary" data-id="'+ obj.data[i].id +'" style="float: left;padding: 6px 25px;">确定</button>'+
									      '</div>'+
									    '</div>'+
									  '</div>'+
									'</div>'+
								'</li>';
					}
					$("#news-list_msg_false").html(html1);
					$(".modal-body_1").html(MsgDetailsHtml);
					$(".modal-body-details_1").html(ContentHtml);
					$("#myModalLabel_1").html(MsgTitle);
					$("#news-list_msg_false li").hover(function(){
						$(this).children().children("div.news-list-item-right").children("div.news-list-item-right-op").children().show();
					},function(){
						$("#news-list_msg_false li").children().children("div.news-list-item-right").children("div.news-list-item-right-op").children().hide();
					});
					if(obj.count == 0){
						li_1 = "";
						$(".pagination_1").html(li_1);
						$("#news-list_msg_false").html("目前没有消息");
						$("#news-list_msg_false").css("text-align","center");
						$("#news-list_msg_false").css("margin-top","50px");
					}
				},
				complete : function(XMLHttpRequest, textStatus) {
					if(isFirst_1){
						creatPageBar_1(wh_count_1,PageSize);
						isFirst_1 = false;
			        }
				},
				error:function(){
					
				}
			});
		}
		
		function creatPageBar_1(count,PageSize){
			var WHPageBar = document.getElementById('WH-pagebar_1');
			var CurrentPage = 1;//起始页
			var SingleCount = Math.ceil(count/PageSize);//翻页显示个数
			var PageCount = Math.ceil(count/PageSize);//总页数
			WHPageBar.innerHTML="";
			WH_Pagebar({
				id:'WH-pagebar_1', //容器ID : 必选参数
				CurrentPage:CurrentPage,   //当前页 ： 可选参数，默认值为1
				SingleCount:SingleCount,   //显示数目： 可选参数，只能为奇数，默认值为7，
				PageCount:PageCount,   //必选参数
				callback : function(pagenow,pagecount){		
					//mark.innerHTML='当前页:' + pagenow +',总共页:'+pagecount;
					$("#home_Page_video_audio_text").html("");
					Unread_msg(pagenow - 1);
				}
			})
		}
		
		//删除delete
		$("#news-list_msg_false").on('click',"li .modal .modal-dialog .modal-content .modal-footer .btn-primary",function(event){
			var deleteID = $(this).data('id');
			btn_delete(deleteID);
		});

		//封装清空所有
		function empty() {
			$("#home_Page_video_audio_text").html("");//每次点击时先清空,进行加载新的列表
			$(".pagination *").remove();//每次进行筛选时,进行提前页码清空
			$(".pagination_1 *").remove();//每次进行筛选时,进行提前页码清空
		}
		
		//清空所有信息
		$("#Msg_clear").click(function(){
			var url = "<c:url value='/msg/clear'></c:url>";
			var PageSize = 20;
			$.ajax({
				url: url,
				type: 'POST',
				dataType: 'html',
				data:{
					uuid: uuid
				},
				success:function(data){
					console.log(data);
					if(data <= 0){
						//console.log("数据删除失败或则没有数据！");
					}else{
						location.reload();
					}
				},
				error:function(){
					//console.log()
				}
			});
		});
		
		if($("#news-list_msg_1").html() == ""){
			$(".pagination_1").html("");
		}
		
		$("#news-list_msg").on("click","li div.news-list-item-wrap a",function(){
			init_msg(0);
			empty();
		});
		
		$("#news-list_msg_false").on("click","li div.news-list-item-wrap a",function(){
			Unread_msg(0);
			empty();
		});
		
	</script>
</body>
</html>
